
#include "ednn.h"



int main(int argc, char *argv[])
{
    ednn_uint8_t *input_buf;
    struct ednn_tensor *input;
    ednn_shape3d_t input_shape = shape3d(32, 32, 1);
    ednn_model_t *model = ednn_model_create("ednnNet");
    if (!model) {
        ednn_err("model create err");
        return -1;
    }
    
    ednn_layer_add(model, Input(input_shape));
    ednn_layer_add(model, Conv2D(12, kernel(3,3), stride(1,1),
        dilation(1,1), EDNN_SAME_PADDING));
    ednn_layer_add(model, MaxPool(kernel(2,2), stride(2,2), 
        EDNN_SAME_PADDING));
    ednn_layer_add(model, Conv2D(24, kernel(3,3), stride(1,1),
        dilation(1,1), EDNN_SAME_PADDING));
    ednn_layer_add(model, MaxPool(kernel(2,2), stride(2,2), 
        EDNN_SAME_PADDING));
    ednn_layer_add(model, Conv2D(48, kernel(3,3), stride(1,1),
        dilation(1,1), EDNN_SAME_PADDING));
    ednn_layer_add(model, MaxPool(kernel(2,2), stride(2,2), 
        EDNN_SAME_PADDING));
    ednn_layer_add(model, Flatten());
    ednn_layer_add(model, Dense(96));
    ednn_layer_add(model, Dense(10));
    ednn_layer_add(model, Softmax());
    ednn_layer_add(model, Output(shape3d(10, 1, 1)));

    ednn_model_compile(model);
    ednn_model_weights_load_frombuff(model, EDNN_NULL);
    ednn_model_summary(model);

    input_buf = ednn_mem_zalloc(input_shape.h*input_shape.w*input_shape.c);
    ednn_shape_t dim[3] = {input_shape.h, input_shape.w, input_shape.c};
    input     = ednn_tensor_create(dim, 3);
    input->pd = input_buf;
    ednn_model_run(model, input);

    return 0;
}